import 'package:flutter_device_info_plugin/flutter_device_info_plugin.dart';

class FMDeviceManager {

  FMDeviceManager._privateConstructor();

  static final FMDeviceManager _instance = FMDeviceManager._privateConstructor();

  factory FMDeviceManager() {
    return _instance;
  }

  String batteryLevel = '';
  bool batteryState = false;

  final _flutterDeviceInfoPlugin = FlutterDeviceInfoPlugin();

  Future<String> idfa() async {
    String idfa = await _flutterDeviceInfoPlugin.getIDFA() ?? '';
    return idfa;
  }

  Future<String> idfv() async {
    String idfv = await _flutterDeviceInfoPlugin.getIDFV() ?? '';
    return idfv;
  }

  Future<String> appVersion() async {
    String appVersion = await _flutterDeviceInfoPlugin.getAppVersion() ?? '';
    return appVersion;
  }

  Future<String> systemVersion() async {
    String sysVersion = await _flutterDeviceInfoPlugin.getSystemVersion() ?? '';
    return sysVersion;
  }

  Future<String> systemName() async {
    String sysName = await _flutterDeviceInfoPlugin.getSystemName() ?? '';
    return sysName;
  }

  Future<String> originalDeviceInfo() async {
    String info = await _flutterDeviceInfoPlugin.originalDeviceInfo() ?? '';
    return info;
  }

  Future<String> deviceNameplate() async {
    String info = await _flutterDeviceInfoPlugin.deviceNameplate() ?? '';
    return info;
  }

  Future<String> timeZone() async {
    String time = await _flutterDeviceInfoPlugin.getLocalTimeZone() ?? '';
    return time;
  }

  Future<String> languageCode() async {
    String languageCode = await _flutterDeviceInfoPlugin.getLocalLanguageCode() ?? '';
    return languageCode;
  }

  Future<Map<dynamic,dynamic>> wifiInfo() async {
    Map<dynamic,dynamic> wifiInfo = await _flutterDeviceInfoPlugin.getWifiInfo() ?? {};
    return wifiInfo;
  }

  Future<bool> isSimulator() async {
    bool isSimulator = await _flutterDeviceInfoPlugin.isSimulator() ?? false;
    return isSimulator;
  }

  Future<bool> isPhoneJailbreak() async {
    bool isPhoneJailbreak = await _flutterDeviceInfoPlugin.isPhoneJailbreak() ?? false;
    return isPhoneJailbreak;
  }

  Future<String> totalDiskSize() async {
    String size = await _flutterDeviceInfoPlugin.getTotalDiskSize() ?? '';
    return size;
  }

  Future<String> totalMemorySize() async {
    String size = await _flutterDeviceInfoPlugin.getTotalMemorySize() ?? '';
    return size;
  }

  Future<String> availableDiskSize() async {
    String size = await _flutterDeviceInfoPlugin.getAvailableDiskSize() ?? '';
    return size;
  }

  Future<String> availableMemorySize() async {
    String size = await _flutterDeviceInfoPlugin.getAvailableMemorySize() ?? '';
    return size;
  }

  Future<String> reachableType() async {
    String reachableType = await _flutterDeviceInfoPlugin.getNetReachableType() ?? '';
    return reachableType;
  }

}